import { createStore } from 'vuex';

export default createStore({
  state: {
    todo: [] as string[],
    done: [] as string[],
    deletes: [] as string[],
  },
  mutations: {
    add(state, value) {
      state.todo.push(value);
    },
    deletes(state, index) {
      const item = state.todo[index];
      state.todo.splice(index, 1);
      state.deletes.push(item);
    },
    check(state, index) {
      const item = state.todo[index];
      state.todo.splice(index, 1);
      state.done.push(item);
    },
  },
  actions: {
  },
  modules: {
  },
});
